const proxy = require('http-proxy-middleware')

// const target = 'https://case.wuhuzcw.cn/'
const target = 'http://shipinparty.zhichu.tech/'

module.exports = function (app) {
  // app.use(
  //   proxy('/api/**', {
  //     target: 'http://localhost:3000/',
  //     changeOrigin: true
  //   })
  // )
  app.use(
    proxy('/api/**', {
      target,
      // target: 'http://hu.zhichu.tech/',
      // target: 'http://172.25.100.20/',
      changeOrigin: true
    })
  )
  app.use(
    proxy('/txapi/', {
      target,
      changeOrigin: true,
      pathRewrite: {
        '^/txapi': ''
      }
    })
  )
  app.use(
    proxy('/upload/', {
      target,
      changeOrigin: true
    })
  )
  app.use(
    proxy('/uploads/', {
      target,
      changeOrigin: true
    })
  )
}
